import axios from 'axios';
import api from 'api/api'
import qs from 'qs'



//获取活动
export function getActivity(){
	let url='/home/activity';
    let data={
		
	}
    return api.get(url, {params: data});
}

//首页领取
export function getGift(type){
	let url='/home/receive';
    let data={
		type:type
	}
    return api.get(url, {params: data});
}

export function getBanner(type){
	let url='/home/banner';
    let data={
		type:type,	
	}
    return api.get(url, {params: data});
}
//游戏列表
export function gameList(type,page,keywords,typeId,pageSize,platform){
	let url='/game/game-list';
    let data={
        type:type,
		page:page,
		keywords:keywords,
		typeId:typeId,
		pageSize:pageSize,
		platform:platform,
	}
    return api.get(url, {params: data});
}

//折扣列表
export function discountList(type,page,keywords,typeId,pageSize,platform,game_version){
	let url='/game/game-list';
    let data={
        type:type,
		page:page,
		keywords:keywords,
		typeId:typeId,
		pageSize:pageSize,
		platform:platform,
		game_version:3
	}
    return api.get(url, {params: data});
}
//游戏分类
export function gameCategory(){
	let url='/game/game-category';
    return api.get(url);
}
//游戏详情
export function gameDetail(gameId){
    let url='/game/game-detail';
    let data={
		gameId:gameId
    }
    return api.get(url, {params: data});
}
//评论列表
export function getCommentList(gameId,page,id){
    let url='/comment/list';
    let data={
		gameId:gameId,
		page:page,
		id:id
    }
    return api.get(url, {params: data});
}
//发表评论
export function publishComment(con_id,content,pid,by_userid){
    let url='comment/add';
    let data={
		con_id:con_id,
		content:content,
		pid:pid,
		by_userid:by_userid
    }
    return api.post(url,data);
}
//点赞
export function gameLike(by_userid,comment_id,con_id,con_type) {
	let url = '/game/like';
	let data = {
		by_userid: by_userid,
		comment_id:comment_id,
		con_id:con_id,
		con_type:1
	}
	return api.post(url,data);
}
//获取礼包key
export function receiveGift(giftid) {
	let url = '/sdk/receivegift';
	let data = {
		gift_id: giftid,
	}
	return api.post(url,data);
}
//游戏下载
export function gameDown(game_id,agent,platform) {
	let url = '/game/down';
	let data = {
		game_id: game_id,
		agent:agent,
		platform:platform
	}
    return api.get(url, {params: data});
}
//取消游戏收藏
export function cancel_collection(game_id) {
	let url = '/user/cancel-collection';
	let data = {
		game_id: game_id,
	}
	return api.delete(url,{params: data});
}
//游戏收藏
export function collection(game_id) {
	let url = '/user/collection';
	let data = {
		game_id: game_id,
	}
	return api.post(url,data);
}
//获取开服表
export function getServer(page,type) {
	let url = '/home/open-service';
	let data = {
		page: page,
		type: type
	}
	return api.get(url, {params: data});
}


//活动详情
export function getActivityDetail(actId){
    let url='/act/detail';
    let data={
		actId:actId
    }
    return api.get(url, {params: data});
}

//我的收藏
export function getCollect(page){
	let url='user/my-collection';
	let data = {
		page: page,
	}
    return api.get(url,{params: data});
}

//用户信息
export function getUserInfo(uid){
	let url='/user/user-info';
	let data = {
		uid: uid
	}
    return api.get(url,{params: data});
}
//上传头像
export function setAvator(avatar){
	let url='/user/avatar';
	let data = {
		avatar: avatar,
		suffix:'png'
	}
	return api.post(url,data);
}
//修改用户基本接口
export function editUserInfo(nickname,sex,qq){
	let url='/user/user-info-edit';
	let data = {
		nickname: nickname,
		sex:sex,
		qq:qq
	}
	return api.put(url,data);
}
//邀请列表
export function inviteList(page){
	let url='/user/invite-list';
	let data = {
		page: page
	}
	return api.get(url,{params: data});
}
//我的红包
export function packetList(page){
	let url='/user/red-envelope';
	let data = {
		page: page
	}
	return api.get(url,{params: data});
}

//红包规则 
export function rule(){
	let url='/user/red-rule';
	return api.get(url);
}

export function packetArea(page){
	let url='/user/red-area';
	let data = {
		page: page
	}
	return api.get(url,{params: data});
}

//我的礼包
export function userGift(page){
	let url='/user/my-package';
	let data = {
		page: page
	}
	return api.get(url,{params: data});
}
//美女客服
export function customerService(agent){
	let url='/sdk/customer-service';
	let data = {
		agent: agent
	}
	return api.post(url,data);
}

//红包列表
export function envelopeList(){
	let url='/user/envelope-list';
	return api.get(url);
}

//领取红包
export function receivEnvelope(id){
	let url='/user/receiv-envelope';
	let data = {
		r_id:id
	}
	return api.post(url,data);
}

//返利指南
export function getGuide(){
	let url='/rebate/guide';
	return api.get(url);
}

//申请记录
export function record(page){
	let url='/rebate/record';
	let data = {
		page:page
	}
	return api.get(url,{params: data});
}

//返利申请
export function apply(page){
	let url='/rebate/list';
	let data = {
		page:page
	}
	return api.get(url,{params: data});
}

//申请返利
export function submitApply(id,gameId,roleid,rolename,server,serverid,remarks){
	let url='/rebate/apply';
	let data = {
		id:id,
		gameId:gameId,
		roleid:roleid,
		rolename:rolename,
		server:server,
		serverid:serverid,
		remarks:remarks
	}

	return api.post(url,data);
}


//任务中心
export function taskCenter(){
	let url='/task/type';
	return api.get(url);
}

//日常任务
export function taskList(id){
	let data={
		id:id
	}
	let url='/task/list';
	return api.get(url,{params: data});
}

//任务领取
export function taskReceive(id){
	let data={
		id:id
	}
	let url='/task/receive';
	return api.get(url,{params: data});
}

//签到列表
export function signList(){
	let url='/task/signlist';
	return api.get(url);
}

//签到  
export function sign(){
	let url='/task/sign';
	return api.get(url);
}

//积分兑换
export function exchange(game_coin){
	let url='/task/exchange';
	let data = {
		game_coin:game_coin
	}
	return api.post(url,data);
}

//积分领取
export function receivePoint(){
	let url='/task/invite-receive';
	return api.get(url);
}

//抽奖基本信息
export function drawInfo(){
	let url='/act/draw-info';
	return api.get(url);
}

//奖品抽取
export function lotteryDraw(){
	let url='/act/luck-draw';
	return api.get(url);
}

//抽奖记录
export function drawHistory(page,pageSize){
	let url='/act/draw-list';
	let data={
		page:page,
		pageSize:pageSize
	}
	return api.get(url,{params: data});
}